<template>
	<view>
		<!-- 内容 -->
		<view class="u-p-10 cflex-r" :style="{marginTop:index==0?'0rpx':'15rpx'}"
			style="background-color: #FFFFFF;margin: 15rpx 20rpx;border-radius: 15rpx;"
			v-for="(item,index) in itemList" :key="index" @tap="onItemClick(item.id)">
			<view class="cflex-r" style="flex: 1;">
				<image :src="item.photo" style="width: 220rpx;height: 170rpx;border-radius:15rpx;"
					mode="aspectFill"></image>
				<view class="u-m-l-5" style="justify-content: space-around;">
					<view style="font-weight: bold;font-size: 26rpx; margin:6rpx 6rpx;">{{item.name}}</view>
					<view
						style="color: #A9A9A9;margin: 5rpx 6rpx;font-size: 20rpx;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;width: 300rpx;">
						{{item.itemDes}}
					</view>
		
					<view class="cflex-r" style="align-items: center;margin: 5rpx 6rpx;">
						<image src="@/static/order/shijian.png"
							style="width: 25rpx;height: 25rpx;margin-right: 4rpx;"></image>
						<text style="color: #838383;font-size: 20rpx;margin: 5rpx;">{{item.timeSpan}}小时</text>
						<text style="color: #838383;margin: 5rpx;font-size: 20rpx;">最近已售{{item.xiaoLiang}}</text>
					</view>
		
					<view class="cflex-r" style="align-items: center;margin-left: 5rpx;">
						<text style="color: #FB8500;font-weight: bold;font-size: 28rpx;">￥{{item.disPrice}}~{{item.price}}</text>
						<!-- <text
							style="text-decoration: line-through; color: #AAAAAA;margin-left: 10rpx;font-size: 24rpx;">￥{{item.price}}</text> -->
					</view>
				</view>
			</view>
			<view class="cflex-c" style="justify-content: center; align-items: center;">
				<view style="background-color: #FF5400; 
						width: 110rpx;height: 40rpx;
						border-radius: 10rpx;color: #FFFFFF;
						text-align: center;
						font-size: 20rpx;
						line-height: 40rpx;">
					选择服务
				</view>
			</view>
			</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code:'',
				page: {
					No: 1,
					Size: 20
				},
				itemList:'',
			}
		},
		onLoad(e) {
			this.code = e.code
			console.log(e)
			uni.setNavigationBarTitle({
				title:e.name
			})
			this.swiperShow()
		},
		methods: {
			onItemClick(index) {
				let option = JSON.stringify({
					goodsid: index
				});
				uni.navigateTo({
					url: "/pagesB/home/goods_detail?option=" + option
				})
			},
			async swiperShow() {
				let obj = {
					sort: 0,
					pageNo: this.page.No,
					pageSize: this.page.Size,
					typeCode: this.code
				}
				this.$request("kehu/home/home", obj).then(res => {
					let tempLists = res.data.itemList == null ? [] : res.data.itemList;
					if (this.page.No == 1) {
						this.itemList = [];
					}
					this.itemList = this.itemList.concat(tempLists);
					this.page.No = this.page.No + 1;
				});
			
			},
		}
	}
</script>

<style scoped>


	.bigtype {
		padding: 15rpx;
		background-color: #f8f8f8;
		border: 1rpx solid #f8f8f8;
		margin-right: 15rpx;
		font-size: 32rpx;
		border-radius: 10rpx;
		color: #B6B6B6;
	}

	.bigtype1 {
		padding: 15rpx;
		background-color: #fff;
		border: 1rpx solid #4578F7;
		margin-right: 15rpx;
		font-size: 32rpx;
		border-radius: 10rpx;
		color: #4578F7;
	}

	.big_box {
		display: flex;
		align-items: center;
		margin-bottom: 20rpx;
		margin-left: 30rpx;
		margin-top: 20rpx;
	}
</style>
